<%@ page import="java.util.Calendar" %> <%@ page import="java.util.Locale" %>
<%-- Created by IntelliJ IDEA. User: Administrator Date: 2016/3/30 Time: 11:56 To change this template use File | Settings | File Templates. --%>
<%@ page contentType="text/html;charset=UTF-8"  language="java"%>
<%
    Locale locale = request.getLocale(); /* 获取用户的本地优化信息*/
    Calendar calendar = Calendar.getInstance(locale); /*获取用户所在地的时间*/
    int hour = calendar.get(Calendar.HOUR_OF_DAY); /*获取小时*/
    String greeting = "";
    if (hour <= 6) greeting = "凌晨好，您该睡觉了！！！";
    else if(hour <= 9) greeting = "早上好";
    else if(hour <= 12) greeting = "上午好";
    else if(hour <= 18) greeting = "下午好";
    else if(hour <= 24) greeting = "晚上好";
    else{}
%>
<html>
<head>
    <title>Test</title>
</head>
<body>
<h1><%= greeting %></h1>
<jsp:useBean id="person" class="com.Test.Person" scope="page"/>
<jsp:useBean id="personCount" class="com.Test.Person" scope="session"/> <%-- 个人访问 --%>
<jsp:useBean id="totalCount" class="com.Test.Person" scope="application"/> <%-- 所有人访问 --%>
<jsp:setProperty name="person" property="*"/>
<table width="400px" height="150px">
    <tr>
        <td>姓名：</td>
        <td><jsp:getProperty name="person" property="name"/></td>
    </tr>
    <tr>
        <td>年龄：</td>
        <td><jsp:getProperty name="person" property="age"/></td>
    </tr>
    <tr>
        <td>性别：</td>
        <td><jsp:getProperty name="person" property="sex"/></td>
    </tr>
    <tr>
        <td>个人访问:</td>
        <td><jsp:getProperty name="personCount" property="count"/></td>
    </tr>
    <tr>
        <td>所有人访问:</td>
        <td><jsp:getProperty name="totalCount" property="count"/></td>
    </tr>
    <tr>
        <td>
            <input type="button" onclick="history.go(-1);" value="返回"/>
        </td>
    </tr>
</table>

<table align="center" bgcolor="#999999" cellspacing="1">
    <tr>
        <td bgcolor="#FFFFFF">
            <jsp:plugin type="applet" width="500" height="400" code="Graph.class"
            codebase="http://java.sun.com/applets/jdks/1.4/demo/applets/GraphLayout/">
                <jsp:params>
                    <jsp:param name="edges" value="joe-food,joe-dog joe-tea"/>
                    <jsp:param name="center" value="joe"/>
                </jsp:params>
                <jsp:fallback>您的浏览器不支持Java Applet</jsp:fallback>
            </jsp:plugin>
        </td>
    </tr>
</table>
</body>
</html>
